(function() {

  describe("AdminUserListingModel", function() {
    var listingModel;
    listingModel = null;
    beforeEach(function() {
      this.server = sinon.fakeServer.create();
      listingModel = new AdminUserListingModel();
      listingModel.set("Page", 1);
      listingModel.set("Size", 10);
      listingModel.set("Column", "Email");
      listingModel.set("Direction", 1);
      return listingModel.set({
        "Filter": {
          "Email": "TestEmail",
          "Login": "TestLogin"
        }
      });
    });
    afterEach(function() {
      return this.server.restore();
    });
    it("Listing model should has valid url", function() {
      return expect(listingModel.url()).toEqual(SiteMap.Admin.Users.Listing + "?page=1&size=10&Column=Email&Direction=1&Filter.Email=TestEmail&Filter.Login=TestLogin");
    });
    return it("Listing model should has valid parse features", function() {
      this.server.respondWith("GET", SiteMap.Admin.Users.Listing + "?page=1&size=10&Column=Email&Direction=1&Filter.Email=TestEmail&Filter.Login=TestLogin", [
        200, {
          "Content-Type": "application/json"
        }, '{ "Filter":{"Email":"megaEmail","Login":"megaLogin"},"Page": 2, "Size":15, "TotalPages": 10,"Direction":0,"Column":"Login","Users":[{"UserId":1}, {"UserId":2}]}'
      ]);
      listingModel.fetch();
      this.server.respond();
      expect(listingModel.get("Page")).toEqual(2);
      expect(listingModel.get("Size")).toEqual(15);
      expect(listingModel.get("TotalPages")).toEqual(10);
      expect(listingModel.get("Direction")).toEqual(0);
      expect(listingModel.get("Column")).toEqual("Login");
      expect(listingModel.get("Filter")).toEqual({
        Email: "megaEmail",
        Login: "megaLogin"
      });
      return expect(listingModel.get("Users").length).toEqual(2);
    });
  });

  describe("AdminUserEditModel", function() {
    var editModel;
    editModel = null;
    beforeEach(function() {
      this.server = sinon.fakeServer.create();
      editModel = new AdminUserEditModel();
      return editModel.set("UserId", 1);
    });
    afterEach(function() {
      return this.server.restore();
    });
    it("Edit model should has valid url", function() {
      return expect(editModel.url()).toEqual(SiteMap.Admin.Users.Edit + "?userId=1");
    });
    return it("Edit model should has valid parse features", function() {
      this.server.respondWith("GET", SiteMap.Admin.Users.Edit + "?userId=1", [
        200, {
          "Content-Type": "application/json"
        }, '{ "Email":"megaEmail","Login":"megaLogin","Status": 2, "Avatar":"TestAvatar"}'
      ]);
      editModel.fetch();
      this.server.respond();
      expect(editModel.get("Email")).toEqual("megaEmail");
      expect(editModel.get("Login")).toEqual("megaLogin");
      expect(editModel.get("Status")).toEqual(2);
      return expect(editModel.get("Avatar")).toEqual("TestAvatar");
    });
  });

}).call(this);
